﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Autodesk.AutoCAD.Geometry;
using Autodesk.AutoCAD.EditorInput;

namespace ZDMHelper
{
    public partial class FormElevation : Form
    {
        private Point3d basePoint = new Point3d();
        private Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; 

        public Point3d BasePoint
        {
            get { return basePoint; }
        }

        public bool DrawControl
        {
            get { return this.ccbControl.Checked; }
        }

        public bool DrawLoad
        {
            get { return this.ccbLoad.Checked; }
        }

        public bool DrawRiver
        {
            get { return this.ccbRiver.Checked; }
        }

        public FormElevation()
        {
            InitializeComponent();
        }

        private void btnPickup_Click(object sender, EventArgs e)
        {
            //跳到cad环境拾取点
            this.Hide();
            PromptPointOptions prPointOptions = new PromptPointOptions("选择基点");
            PromptPointResult prPointRes;
            prPointRes = ed.GetPoint(prPointOptions);
            if (prPointRes.Status != PromptStatus.OK)
            {
                ed.WriteMessage("Error");
            }
            else
            {
                basePoint = prPointRes.Value;
                txtBasePointX.Text = Math.Round(basePoint.X,3).ToString();
                txtBasePointY.Text = Math.Round(basePoint.Y,3).ToString();
            }
            this.Show();
        }
    }
}
